package edu.task.repository;

import edu.task.model.SysRoleMenu;
import edu.task.model.SysRoleMenuPK;
import edu.task.model.SysUserProject;
import edu.task.model.SysUserProjectPK;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface SysUserProjectRepository extends JpaRepository<SysUserProject, SysUserProjectPK> {

    @Modifying
    @Query(value = " delete up from sys_user_project as up " +
            "inner join sys_user as u on up.user_id = u.user_id " +
            "inner join sys_project as p on up.project_id = p.project_id " +
            "where up.project_id=:projectId ", nativeQuery = true)
    int deleteUserRoleByProjectId(Long projectId);
}
